<?php
/**
 * Each engineer has a duty to keep the code elegant
 * Created by wolffy.
 * Author @wolffy<13750088090@sina.cn>
 * Date: 2018/12/19
 * Time: 21:47
 */
namespace App\Http\Controllers\BackendApi;

use App\Http\Requests\BackendApi\PopupRequest;
use App\Services\BackendApi\PopupService;
use Illuminate\Http\Request;

class PopupController extends ApiController
{
    protected $popupService;

    public function __construct(PopupService $popupService)
    {
        $this->popupService = $popupService;
    }

    public function getList(Request $request)
    {
        return $this->popupService->getList($request);
    }

    public function create(PopupRequest $popupRequest)
    {
        return $this->popupService->create($popupRequest->except('app_id', 'sign'));
    }

    public function edit(Request $request)
    {
        return $this->popupService->edit($request->id);
    }

    public function update(PopupRequest $popupRequest)
    {
        $id = $popupRequest->id;
        return $this->popupService->update($id, $popupRequest->except('app_id', 'sign', 'id'));
    }

    public function delete(Request $request)
    {
        return $this->popupService->delete($request->id);
    }
}